<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@page import="cn.edu.scut.fsearch.user.UserSearchOption"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<%
			response.setCharacterEncoding("UTF-8");
			String text = request.getParameter("searchText");
			text = new String(text.getBytes("ISO-8859-1"), "utf-8");
			int pageIndex = Integer.parseInt(request.getParameter("page"));
			int perPage = Integer.parseInt(request.getParameter("perPage"));
			String hasCluster = request.getParameter("hs");
			String spanText = request.getParameter("span");
			int span;
			if (spanText == null || spanText.equals(""))
				span = 0;
			else
				span = Integer.parseInt(spanText);
			String[] eduse = request.getParameterValues("checkeduse");
			String[] gxse = request.getParameterValues("checkgxse");
			//String[] topicse = request.getParameterValues("topicse");
			String topicse = request.getParameter("topicse");
			String ipv = request.getParameter("ipv");
			String tflag = request.getParameter("flag");
			String ttflag = tflag.toString();
			if (tflag.endsWith("-1")) {ttflag = "0";}  //add by tyc
			if ((eduse != null || gxse != null || topicse != null) && ipv != null) {
				UserSearchOption preOption = new UserSearchOption(ipv, eduse,
						gxse,topicse);
				request.getSession().setAttribute("preOption", preOption);
			}
			//下面是为了兼容IE缓存问题做的修改
			if(ipv == null)
				ipv = "2";
			String tmpEdu,tmpGx,tmpTopic;
			if(eduse == null)
				tmpEdu = "";
			else tmpEdu = eduse.toString();
			if(gxse == null)
				tmpGx = "";
			else tmpGx = gxse.toString();
			if(topicse == null)
				tmpTopic = "";
			else tmpTopic = topicse.toString();
		%>
		<title><%=text%>&nbsp;&nbsp;下一代互联网分布式搜索引擎平台</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link href="css/main.css" rel="stylesheet" type="text/css" />
		<link href="css/suggest.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="script/jquery.js"
			language="javascript"></script>
		<script type="text/javascript" src="script/jquery.cookie.js" language="javascript"></script>
		<script type="text/javascript" src="script/jquery.jsoncookie.js" language="javascript"></script>
		<script type="text/javascript" src="script/json.js"></script>
		<script type="text/javascript" src="script/collector.js"></script>
		<script type="text/javascript" src="script/myPageShow.js" language="javascript"></script>
		

		<script type="text/javascript">
	var sflag = '<%=tflag%>';
	//开始搜索
	startDoSearch('<%=text%>','<%=pageIndex%>','<%=perPage%>','<%=span%>','<%=hasCluster%>','<%=ipv%>','<%=tmpEdu%>','<%=tmpGx%>','<%=tmpTopic%>',sflag);
	
	
	function contentsearch1(perPage)
	{
		var qtext = document.getElementById("searchtext1");
	 	if(qtext.value == null || qtext.value == "")
	  	{
	  	 	alert("请输入查询关键字!");
	  	}
	  	else
	  	{	
	  		var value = qtext.value;

			var url="content.jsp?searchText="+encodeURI(value);
	  		url += "&page=0&perPage="+perPage;
	  		url += "&hs=0";
	  		url += "&flag="+sflag;
	  		document.form2.action = url;
			document.form2.submit();
		}
	}
	
	function contentsearch2(perPage)
	{
		var qtext = document.getElementById("searchtext2");
	 	if(qtext.value == null || qtext.value == "")
	  	{
	  	 	alert("请输入查询关键字!");
	  		return false;
	  	}
	  	var value = qtext.value;
	  	var url="content.jsp?searchText="+encodeURI(value);
	  	url += "&page=0&perPage="+perPage;
	  	url += "&hs=0";
	  	url += "&flag="+sflag;
	  	document.form3.action = url;
		document.form3.submit();
	}
	
	function startDoSearch(text,page,perPage,span,hs,ipv,edu,gx,topic,flag)
	{
		var url = "searchText="+encodeURI(text);
		url += "&page="+page;
		url += "&perPage="+perPage
		url += "&hs="+hs;
		url += "&ipv="+ipv;
		url += "&eduse="+edu;
		url += "&gxse="+gx;
		url += "&topic="+topic;
		url += "&flag="+flag;
		url += "&span="+span;
		getDetails(url);
	}
	
	//当用点击URL链接的时候，更新日志
	function clickURL(url,wname,type)
	{
		//alert(url+wname+type);
		var stext = '<%=text%>';
		var data = "searchText="+encodeURI(stext);
		data += "&url="+url;
		data += "&wname="+wname;
		data += "&type="+type; 
		$.get("servlet/UserClickURLServlet",data,null);
	
	}
	
	</script>

	</head>

	<body>
				<div id="logobg" align="center">
				<div id="logo">
					<div id="ipv6_enabled_www_test_logo" class="ipv6" align="center"></div>
					<a href="default.jsp"><img src="images/logo.jpg" border="0" />
					</a>
				</div>
			</div>
		<table border=0 align="center">
			<tr>
				<td>
				</td>
			</tr>
		</table>



		<table border="0" align="center">
		<tr>
		<td>
		</td>
		<td>
			<table>
			<tr>
				<td>
					<form name="form2" method="post"
						onsubmit="contentsearch1('<%=perPage%>')">
						<div id="searchinput">
							<input type="text" id="searchtext1" value="<%=text%>" />
							<input id="searchsubmit" type="submit" value="" />
						</div>
					</form>
				</td>
				<td>
					<a id="ipv6link" href="advanced.jsp">高级搜索</a>
				</td>
			</tr>
			<tr>
				<td>
					<div id="costTimeShow"></div>
				</td>
			</tr>
		</table>
		</td>
		</tr>
			<tr>
				<td width="200" align="left" valign="top">
					<table>
						<tr>
							<td>
								<Font size=4><strong>时间聚类</strong> </Font>
							</td>
						</tr>
						<tr>
							<td>
								<div id="timeCluster">
									<img src="images/loading.gif">
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<Font size=4><strong>空间聚类</strong> </Font>
							</td>
						</tr>
						<tr>
							<td>
								<div id="spaceCluster">
									<img src="images/loading.gif">
								</div>
							</td>
						</tr>
<!--  
						<tr>
							<td>
								<Font size=4><strong>来源站点</strong> </Font>
							</td>
						</tr>
						<tr>
							<td>
								<div id="siteCluster">
									<img src="images/loading.gif">
								</div>
							</td>
						</tr>
-->
						<tr>
							<td>
								<Font size=4><strong>资源分布</strong> </Font>
							</td>
						</tr>
						<tr>
							<td>
								<div id="v4v6PieChart"></div>
							</td>
						</tr>
					</table>
				</td>
				<td width="750" valign="top">
					<table>
						<tr>
							<td>
								<div id="detailsShow">
									<img src="images/loading.gif">
									搜索中...
								</div>
							</td>

						</tr>
						<tr valign="bottom">
							<td valign="bottom">
								<div id="pageIndex"></div>
							</td>
						</tr>
					</table>
				</td>
				<td valign="top">
					<div id="siteHitBar"></div>
				</td>
			</tr>
			<tr>
			<td>
			</td>
			<td>
					<table>
			<tr>
				<td>
					<form name="form3" method="post"
						onsubmit="return contentsearch2('<%=perPage%>')">
						<div id="searchinput">
							<input type="text" id="searchtext2" value="<%=text%>" />
							<input id="searchsubmit" type="submit" value="" />
						</div>
					</form>
				</td>
				<td>
					<a id="ipv6link" href="advanced.jsp">高级搜索</a>
				</td>
			</tr>
		</table>
			</td>
			</tr>
		</table>
<!-- 
		<table>
			<tr>
				<td width="200">
				</td>
				<td>
					<Font size=4><strong>相关搜索：</strong>
					</Font>&nbsp;&nbsp;
				<td>
				<td>
					<div id="relativeSearch">
						<img src="images/loading.gif">
					</div>
				</td>
			</tr>
		</table>
 -->
 

		<table align="center">
			<tr>
				<td>
					<div id="copyright">
						<p>
							&nbsp;
						</p>
						<p>
							&nbsp;
						</p>
						<p>
							版权所有 华南理工大学广东省网络重点实验室&nbsp;

						</p>
						<p>
							Copyright (c) 2010 SCUT CCNL All Rights Reserved &nbsp;
							<a href="aboutus.jsp"><font
								style="color: #aaa; text-decoration: none">关于我们</font> </a>
						</p>
					</div>
				</td>
			</tr>
		</table>
	</body>
</html>
